#include <iostream>

using namespace std;

int main()
{
	int T; cin >> T;
	while(T--)
	{
		int n, m, l, r; cin >> n >> m >> l >> r;
		int k = n - m;
		if(k > r) 
		{
			k -= r;
			r = 0;
			l += k;
		}
		else
		{
			r -= k;
		}
		cout << l << " " << r << endl;
		
	}
	return 0;
}


